package com.pti.usermanager.dao.impl;

import com.pti.usermanager.dao.api.MenuDao;
import com.pti.usermanager.dao.mapper.MenuMapper;
import com.pti.usermanager.dao.po.MenuPo;
import com.pti.usermanager.web.dto.request.SaveMenuRequest;
import com.pti.usermanager.web.dto.request.UpdateMenuRequest;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassName: MenuDaoImpl
 * @Author: liuyueyang
 * @Description: 菜单数据交换实现层
 * @Date: 2019/1/18
 */
@Repository
public class MenuDaoImpl implements MenuDao{

    private static final Logger logger = LogManager.getLogger(MenuDaoImpl.class);

    @Autowired
    private MenuMapper menuMapper;

    @Override
    public List<MenuPo> findTreeByMenu() {
        return menuMapper.findTreeByMenu();
    }

    @Override
    public MenuPo findAllByMenuId(Long menuId) {
        return menuMapper.findAllByMenuId(menuId);
    }

    @Override
    public List<MenuPo> findAllMenu(String menuNm) {
        return menuMapper.findAllMenu(menuNm);
    }

    @Override
    public void saveMenu(SaveMenuRequest saveMenuRequest) {
        menuMapper.saveMenu(saveMenuRequest);
    }

    @Override
    public void updateMenu(UpdateMenuRequest updateMenuRequest) {
        menuMapper.updateMenu(updateMenuRequest);
    }

    @Override
    public void delMenu(Long menuId) {
        menuMapper.delMenu(menuId);
    }

    @Override
    public List<MenuPo> findAllByUsrId(Long usrId) {
        return menuMapper.findAllByUsrId(usrId);
    }
}
